home *** CD-ROM | disk | FTP | other *** search
/ NBC Slam Jams! / NBC Slam Jams!.iso / xtras / media_la / fx_set_1.fxm / 00111_Script_Radio Button < prev    next >
Text File  |  1998-01-20  |  2KB  |  90 lines

  1. property pSpriteList, pCurActive, pActive, pCallBackObj, pRefcon
  2.  
  3. on new me, propList
  4.   set pSpriteList = getAProp(propList,#sprites)
  5.   set pCurActive = getAProp(propList,#cur)
  6.   set pActive = getAProp(propList,#active)
  7.   set pCallBackObj = getAProp(propList,#callback)
  8.   set pRefcon = getAProp(propList,#ref)
  9.   
  10.   SetActive(me, pCurActive)
  11.   
  12.   if pCurActive > count(pSpriteList) then set pCurActive = 0
  13.   return(me)
  14. end
  15.  
  16. on Click me, sNum
  17.   if not pActive then exit
  18.   if not integerP(sNum) then set sNum = the clickOn
  19.   if the memberNum of sprite sNum < 1 then exit
  20.   if not (the name of the member of sprite sNum contains "radioButton") then exit
  21.   
  22.   put the name of the member of sprite sNum into memName
  23.   
  24.   set the member of sprite sNum = member (memName&&"Down")
  25.   updateStage
  26.   set selected = TRUE
  27.   
  28.   repeat while the stillDown
  29.     if rollover(sNum) then
  30.       set the member of sprite sNum = member (memName&&"Down")
  31.       set selected = TRUE
  32.     else
  33.       set the member of sprite sNum = member (memName)
  34.       set selected = FALSE
  35.     end if
  36.     updateStage
  37.   end repeat
  38.   
  39.   put getPos(pSpriteList,sNum) into newNum
  40.   
  41.   SetActive(me,newNum)
  42.   if objectP(pCallBackObj) then
  43.     RadioClick(pCallBackObj, pRefcon, pCurActive)
  44.   end if
  45.   return(pCurActive)
  46. end
  47.  
  48. on SetActive me, newNum
  49.   set pCurActive = newNum
  50.   repeat with i = 1 to count(pSpriteList)
  51.     put getAt(pSpriteList,i) into sNum
  52.     puppetSprite sNum, TRUE
  53.     if i = pCurActive then
  54.       set the member of sprite sNum = member "radioButton 1"
  55.     else
  56.       set the member of sprite sNum = member "radioButton 0"
  57.     end if
  58.   end repeat
  59.   --updateStage
  60. end 
  61.  
  62. on SetEnabled me, enabled
  63.   set pActive = enabled
  64.   repeat with i in pSpriteList
  65.     enableInterfaceElement(i,enabled)
  66.   end repeat
  67. end
  68.  
  69.  
  70. on ThisYou me, sNum
  71.   repeat with i = 1 to count(pSpriteList)
  72.     if(getAt(pSpriteList, i) = sNum) then
  73.       return TRUE
  74.     end if
  75.   end repeat
  76.   return FALSE
  77. end
  78.  
  79. on GetActiveRadio me
  80.   return(pCurActive)
  81. end
  82.  
  83. on Release me
  84.   repeat with i = 1 to count(pSpriteList)
  85.     puppetSprite getAt(pSpriteList,i), FALSE
  86.   end repeat
  87. end
  88.  
  89.  
  90.